package top.ysh.condition.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import top.ysh.condition.conditions.ClassCondition;
import top.ysh.condition.conditions.ConditionOnClass;
import top.ysh.condition.domain.User;

@Configuration
public class UserConfig {
    @Bean
    // 自定义条件
    // @Conditional(ClassCondition.class)
    // 使用注解
    // @ConditionOnClass("com.alibaba.fastjson.JSON")
    public User user(){
        return new User();
    }

    @Bean
    @ConditionalOnProperty(name = "it",havingValue = "test")
    public User user2(){
        return new User();
    }
}
